﻿namespace HRM.CORE.REPORT
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraTreeList;
    using DevExpress.XtraTreeList.Columns;
    using Common.Report;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Windows.Forms; using Common;

    public class xfmInsurance : XtraForm
    {
        private SimpleButton btCancel;
        private SimpleButton btPrint;
        private TreeListColumn colName;
        private TreeListColumn colValue;
        private IContainer components;
        private GroupControl groupControl1;
        private DevExpress.Utils.ImageCollection imageCollection1;
        private Guid m_InsuranceTableListID;
        private int m_Value;
        private TreeList treeList1;

        public xfmInsurance()
        {
            this.components = null;
            this.m_InsuranceTableListID = Guid.Empty;
            this.m_Value = 0;
            this.InitializeComponent();
            this.Init();
        }

        public xfmInsurance(Guid InsuranceTableListID)
        {
            this.components = null;
            this.m_InsuranceTableListID = Guid.Empty;
            this.m_Value = 0;
            this.InitializeComponent();
            this.m_InsuranceTableListID = InsuranceTableListID;
            this.Init();
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btPrint_Click(object sender, EventArgs e)
        {
            xfmReport report = new xfmReport("Hợp Đồng Lao Động");
            if (this.m_Value == 0)
            {
                rptCreateInsurance xtraReport = new rptCreateInsurance(this.m_InsuranceTableListID);
                report.SetTitle("Danh s\x00e1ch lao động ph\x00e1t sinh nghiệp vụ BHXH, BHYT");
                report.ShowPrintPreview(xtraReport);
            }
            else if (this.m_Value == 1)
            {
                rpt02aTBH atbh = new rpt02aTBH(this.m_InsuranceTableListID);
                report.SetTitle("Danh s\x00e1ch lao động tham gia BHXH, BHYT (02a-TBH)");
                report.ShowPrintPreview(atbh);
            }
            else if (this.m_Value == 2)
            {
                rpt03aTBH atbh2 = new rpt03aTBH(this.m_InsuranceTableListID);
                report.SetTitle("Danh s\x00e1ch điều chỉnh lao động v\x00e0 mức đ\x00f3ng BHXH, BHYT (03a-TBH)");
                report.ShowPrintPreview(atbh2);
            }
            else if (this.m_Value == 3)
            {
                rpt03bTBH btbh = new rpt03bTBH(this.m_InsuranceTableListID);
                report.SetTitle("Danh s\x00e1ch đề nghị điều chỉnh hồ sơ tham gia BHXH, BHYT (03b-TBH)");
                report.ShowPrintPreview(btbh);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Init()
        {
            this.colValue.Visible = false;
            this.colName.OptionsColumn.AllowEdit = false;
            this.colName.OptionsColumn.ReadOnly = true;
            this.treeList1.ExpandAll();
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xfmInsurance));
            this.btPrint = new SimpleButton();
            this.imageCollection1 = new DevExpress.Utils.ImageCollection(this.components);
            this.btCancel = new SimpleButton();
            this.groupControl1 = new GroupControl();
            this.treeList1 = new TreeList();
            this.colName = new TreeListColumn();
            this.colValue = new TreeListColumn();
            this.imageCollection1.BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.treeList1.BeginInit();
            base.SuspendLayout();
            this.btPrint.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btPrint.ImageIndex = 0;
            this.btPrint.ImageList = this.imageCollection1;
            this.btPrint.Location = new Point(0xd7, 0x13e);
            this.btPrint.Name = "btPrint";
            this.btPrint.Size = new Size(0x5f, 0x18);
            this.btPrint.TabIndex = 2;
            this.btPrint.Text = "Xem trước";
            this.btPrint.Click += new EventHandler(this.btPrint_Click);
            this.imageCollection1.ImageStream = (ImageCollectionStreamer) manager.GetObject("imageCollection1.ImageStream");
            this.imageCollection1.Images.SetKeyName(0, "ico_alpha_Search_16x16.png");
            this.imageCollection1.Images.SetKeyName(1, "ico_alpha_Delete_16x16.png");
            this.imageCollection1.Images.SetKeyName(2, "document2.png");
            this.imageCollection1.Images.SetKeyName(3, "open-16x16.png");
            this.btCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btCancel.ImageIndex = 1;
            this.btCancel.ImageList = this.imageCollection1;
            this.btCancel.Location = new Point(320, 0x13e);
            this.btCancel.Name = "btCancel";
            this.btCancel.Size = new Size(0x5f, 0x18);
            this.btCancel.TabIndex = 3;
            this.btCancel.Text = "Tho\x00e1t";
            this.btCancel.Click += new EventHandler(this.btCancel_Click);
            this.groupControl1.Controls.Add(this.treeList1);
            this.groupControl1.Location = new Point(6, 5);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x199, 0x12d);
            this.groupControl1.TabIndex = 4;
            this.groupControl1.Text = "Loại b\x00e1o c\x00e1o";
            this.treeList1.Appearance.FocusedCell.BackColor = Color.Orange;
            this.treeList1.Appearance.FocusedCell.BackColor2 = Color.White;
            this.treeList1.Appearance.FocusedCell.GradientMode = LinearGradientMode.BackwardDiagonal;
            this.treeList1.Appearance.FocusedCell.Options.UseBackColor = true;
            this.treeList1.BorderStyle = BorderStyles.NoBorder;
            this.treeList1.Columns.AddRange(new TreeListColumn[] { this.colName, this.colValue });
            this.treeList1.Dock = DockStyle.Fill;
            this.treeList1.Location = new Point(2, 0x16);
            this.treeList1.Name = "treeList1";
            this.treeList1.BeginUnboundLoad();
            this.treeList1.AppendNode(new object[] { "Danh s\x00e1ch lao động ph\x00e1t sinh nghiệp vụ bảo hiểm", "0" }, -1, 3, 3, -1);
            this.treeList1.AppendNode(new object[] { "Danh s\x00e1ch lao động tham gia BHXH, BHYT (02a-TBH)", "1" }, 0, 2, 2, -1);
            this.treeList1.AppendNode(new object[] { "Danh s\x00e1ch điều chỉnh lao động v\x00e0 mức đ\x00f3ng BHXH, BHYT (03a-TBH)", "2" }, 0, 2, 2, -1);
            this.treeList1.AppendNode(new object[] { "Danh s\x00e1ch đề nghị điều chỉnh hồ sơ tham gia BHXH, BHYT (03b-TBH)", "3" }, 0, 2, 2, -1);
            this.treeList1.EndUnboundLoad();
            this.treeList1.OptionsBehavior.PopulateServiceColumns = true;
            this.treeList1.OptionsView.ShowColumns = false;
            this.treeList1.OptionsView.ShowHorzLines = false;
            this.treeList1.OptionsView.ShowIndicator = false;
            this.treeList1.OptionsView.ShowVertLines = false;
            this.treeList1.SelectImageList = this.imageCollection1;
            this.treeList1.Size = new Size(0x195, 0x115);
            this.treeList1.TabIndex = 2;
            this.treeList1.FocusedNodeChanged += new FocusedNodeChangedEventHandler(this.treeList1_FocusedNodeChanged);
            this.colName.Caption = "T\x00ean b\x00e1o c\x00e1o";
            this.colName.FieldName = "Name";
            this.colName.MinWidth = 0x37;
            this.colName.Name = "colName";
            this.colName.Visible = true;
            this.colName.VisibleIndex = 0;
            this.colValue.Caption = "Gi\x00e1 trị";
            this.colValue.FieldName = "Value";
            this.colValue.Name = "colValue";
            this.colValue.Visible = true;
            this.colValue.VisibleIndex = 1;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x1a5, 0x160);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.btCancel);
            base.Controls.Add(this.btPrint);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "xfmInsurance";
            base.ShowIcon = false;
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "T\x00f9y Chọn In";
            this.imageCollection1.EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.treeList1.EndInit();
            base.ResumeLayout(false);
        }

        private void treeList1_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            this.m_Value = Convert.ToInt32(e.Node.GetValue(this.colValue).ToString());
        }
    }
}

